package com.pe1n.yangtaopai.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.jude.rollviewpager.RollPagerView;
import com.jude.rollviewpager.adapter.LoopPagerAdapter;
import com.pe1n.yangtaopai.R;
import com.pe1n.yangtaopai.bean.MultiTitleBean;

import java.util.List;

/**
 * Created by Pe1n on 2016/11/23.
 */

public class MyGoodsViewPagerAdapter extends LoopPagerAdapter {

    private Context mContext;
    private List<String> mList;

    public MyGoodsViewPagerAdapter(Context mContext, List<String> mList, RollPagerView viewPager) {
        super(viewPager);
        this.mContext = mContext;
        this.mList = mList;
    }

    @Override
    public View getView(ViewGroup container, int position) {

        ImageView imageView = new ImageView(mContext);
        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        imageView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
        Glide.with(mContext).load(mList.get(position)).placeholder(R.drawable.place_holder).into(imageView);
        return imageView;

    }

    @Override
    public int getRealCount() {
        return mList.size();
    }
}
